#include "CommentReviewDialog.h"

CommentReviewDialog::CommentReviewDialog(QWidget *parent)
    : QDialog{parent}
{
    setWindowTitle("评论举报审批");
    QVBoxLayout *layout = new QVBoxLayout(this);

    approvalResultComboBox = new QComboBox(this);
    approvalResultComboBox->addItem("无效举报");
    approvalResultComboBox->addItem("删除评论");
    approvalResultComboBox->addItem("删除评论并封禁用户7天");
    approvalResultComboBox->addItem("删除评论并封禁用户一年");
    approvalResultComboBox->addItem("删除评论并永久封禁用户");

    // 将下拉框添加到布局中
    layout->addWidget(new QLabel("审批结果:", this)); // 添加标签
    layout->addWidget(approvalResultComboBox);        // 添加下拉框

    QString comboBoxStyle = R"(
        QComboBox {
            padding: 8px 12px;
            border-radius: 6px;
            border: 1px solid #D3D3D3;
            background-color: white;
        }
        QComboBox:hover {
            border: 1px solid #A9A9A9;
        }
    )";
    approvalResultComboBox->setStyleSheet(comboBoxStyle);

    QHBoxLayout *buttonLayout = new QHBoxLayout();
    QPushButton *confirmButton = new QPushButton("确认", this);
    QPushButton *cancelButton = new QPushButton("取消", this);

    connect(confirmButton, &QPushButton::clicked, this, &CommentReviewDialog::accept);
    connect(cancelButton, &QPushButton::clicked, this, &CommentReviewDialog::reject);

    buttonLayout->addWidget(confirmButton);
    buttonLayout->addWidget(cancelButton);
    layout->addLayout(buttonLayout);

    setFixedSize(300, 200); // 设置窗口固定大小

    QFont font("微软雅黑", 10);
    this->setFont(font);

    QString confirmStyle = R"(
        QPushButton {
            padding: 8px 16px;
            border-radius: 6px;
            background-color: #4A90E2;
            color: white;
            border: none;
        }
        QPushButton:hover {
            background-color: #357ABD;
        }
    )";

    QString cancelStyle = R"(
        QPushButton {
            padding: 8px 16px;
            border-radius: 6px;
            background-color: #9E9E9E;
            color: white;
            border: none;
        }
        QPushButton:hover {
            background-color: #616161;
        }
    )";

    confirmButton->setStyleSheet(confirmStyle);
    cancelButton->setStyleSheet(cancelStyle);

    // 对话框背景色
    this->setStyleSheet("QDialog { background-color: #F9F9F9; }");
}

QString CommentReviewDialog::getApprovalResult() const
{
    return approvalResultComboBox->currentText();
}
